package edu.auctionmart

class Location {

	static belongsTo = Profile

	String name
	String addressLine
	String zipCode
	String town
	String state


	static constraints = {
		name(nullable: false)
		addressLine(nullable: false)
		zipCode(validator: { String a ->
			try {
				Integer.parseInt(a)
			} catch (Exception e) {
				return false
			}
			return (a.length() == 5 || a.length() == 9)
		}, nullable: false) //must be original or extended format
		town(nullable: false)
		state(nullable: false, inList:['ME', 'NH', 'MA', 'VT'])
	}
}
